home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Inside Mac Games Volume 5 #3
/
IMG 46 Vol 5-3.iso
/
More Goodies
/
More For Your Game
/
Realmz
/
Character Master Source
/
Character Master
/
character class.h
< prev
next >
Wrap
Text File
|
1996-07-15
|
10KB
|
368 lines
//•••••••••••••••••••••••••••
//• Written by David Wagner •
//• ----------------------- •
//• Created: 1 Jun 1996 •
//•••••••••••••••••••••••••••
#ifndef _CHARACTERCLASS_ // Check to make sure this is only included once
#define _CHARACTERCLASS_
#include "nemesis dialogs.h"
#include "nemesis dialog class.h"
#include "my files.h"
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
// Constants to access the arrays
enum
{
kFirstSaveVs = 0, kLastSaveVs = 7,
kFirstSpecialAbility = 0, kLastSpecialAbility = 7,
kFirstCondition = 0, kLastCondition = 39,
kFirstLevel = 0, kLastLevel = 6,
kFirstSpell = 0, kLastSpell = 11
};
//••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
// Item lists for dialogs
enum
{
kEditCharacterDialogID = 130,
kFirstECTE = 1,
kLastECTE = 33,
diEditGoodConditions = 34,
diEditBadConditions,
diEditSpells,
diEditSpecialInfo,
diEditSpecialAbilities,
kNumOutlines = 13,
diType = 39,
diRace,
diReligion,
diGender
};
const int kECOutline[kNumOutlines] = { 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103 };
enum
{
kEditSpecialAbilitiesID = 131,
kFirstSATE = 3,
kLastSATE = 10,
kSADefault = 19
};
enum
{
kEditSpecialInfoID = 132,
kFirstSITE = 3,
kLastSITE = 16,
kSIDefault = 43,
kSIPopup = 47
};
enum
{
kEditGoodConditionsID = 133,
kFirstGCTE = 4,
kLastGCTE = 27,
kFirstGCCheck = 28,
kLastGCCheck = 51,
kGCDefault = 76,
kGCOutline1 = 77,
kGCOutline2 = 78,
kGCMagicButton = 3
};
enum
{
kEditBadConditionsID = 134,
kFirstBCTE = 4,
kLastBCTE = 19,
kFirstBCCheck = 20,
kLastBCCheck = 35,
kBCDefault = 52,
kBCOutline1 = 53,
kBCOutline2 = 54,
kBCMagicButton = 3
};
enum
{
kEditSpellsID = 135,
kFirstSRadio = 3,
kLastSRadio = 9,
kFirstSCheck = 10,
kLastSCheck = 21,
kSDefault = 22,
kSOutline1 = 23,
kSOutline2 = 24,
kSOutline3 = 28,
kSMagicButton = 26,
kSDescText = 27
};
const int theGoodCondition[24] = { 4, 7, 8, 10, 11, 12,
13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24,
30, 31, 32, 33, 35, 38 };
const int theBadCondition[16] = { 0, 1, 2, 3,
5, 6, 9, 25,
26, 27, 28, 29,
34, 36, 37, 39 };
enum
{
kFirstGC = 0,
kLastGC = 23,
kFirstBC = 0,
kLastBC = 15
};
// Limits for values
enum
{
kSInt8Min = -100,
kSInt8Max = 110,
kSInt16Min = -30000,
kSInt16Max = 30000,
kSInt32Min = -2000000000,
kSInt32Max = 2000000000,
kStatMin = 3,
kStatMax = 25,
kNameMin = 1,
kNameMax = 19,
kLevelMin = 1,
kLevelMax = 50,
kCashMin = 0,
kConditionsMin = -100,
kConditionsMax = 100,
kBaseMovementMax = 22
};
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
//• Start of character class definition •
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
class character
{
protected:
Boolean spellCaster, beenSaved;
FSSpec theFileSpec;
// Variables to hold character info
CharacterFile theCharacter;
Str255 theName;
public:
long editDialog;
character();
character( FSSpec const &, DialogRef );
CharacterFile TheCharacter() { return theCharacter; };
void SetTheCharacter( CharacterFile theC ) { theCharacter = theC; };
OSErr OpenCharacter();
void CheckCharacterValues();
OSErr OpenCharacter( FSSpec const & );
OSErr DoSaveCharacter();
OSErr SaveCharacter();
OSErr RevertCharacter();
void TransferValues();
void SetSaved( Boolean theB ) { beenSaved = theB; };
Boolean BeenSaved() { return beenSaved; };
Boolean SpellCaster() { return spellCaster; };
FSSpec TheFileSpec() { return theFileSpec; };
void SetupENDialogControls();
void FixPopups();
friend class editCharacterDialog;
};
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
//• End of character class definition •
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
class editCharacterDialog:public baseModelessDialog
{
private:
int lastItemHit;
int lastETItemHit;
Boolean nameWarning;
public:
editCharacterDialog():baseModelessDialog( nil, nil, nil, nil )
{
lastItemHit = 0;
lastETItemHit = 1;
nameWarning = true;
};
editCharacterDialog( DialogRef theD, DialogRef theP )
:baseModelessDialog( theD, nil, theP, nil )
{
lastItemHit = 0;
lastETItemHit = 1;
nameWarning = true;
};
void DoItemHit( EventRecord *, int );
void DoUpdateMenus();
Boolean CheckValues();
OSErr DoHandleMenu( long );
void DoSelectAll() { NemesisSelectItemText( thisDialog, lastETItemHit ); };
void DoActivate( EventRecord * theEvent )
{
baseDialog::DoActivate( theEvent );
if( !(((character *)dialogData)->SpellCaster()) )
{
NemesisDimControl( thisDialog, 36 );
}
};
OSErr DoClose();
OSErr DoSADialog();
OSErr DoSIDialog();
OSErr DoGCDialog();
OSErr DoBCDialog();
OSErr DoSDialog();
};
class editSpecialAbilitiesDialog:public baseMovableDialog
{
private:
int lastItemHit;
int lastETItemHit;
CharacterFile temporaryCharacter;
Boolean *nothingChanged;
Boolean origNothingChanged;
public:
editSpecialAbilitiesDialog():baseMovableDialog() { lastItemHit = kFirstSATE; lastETItemHit = kFirstSATE; };
editSpecialAbilitiesDialog( DialogRef thisD, WindowRef parentW ): baseMovableDialog( thisD, parentW )
{ lastItemHit = kFirstSATE; lastETItemHit = kFirstSATE; };
void SetupCharPtr( CharacterFilePtr theC )
{ dialogData = (long)theC; temporaryCharacter = *((CharacterFilePtr)dialogData); };
void SetupSaved( Boolean * theB ) { nothingChanged = theB; origNothingChanged = *theB; };
void DoItemHit( EventRecord *, int );
void DoSelectAll() { NemesisSelectItemText( thisDialog, lastETItemHit ); };
void DoUpdateMenus();
void SetupDialog();
Boolean CheckValues();
void TransferValues();
};
class editSpecialInfoDialog:public baseMovableDialog
{
private:
int lastItemHit;
int lastETItemHit;
CharacterFile temporaryCharacter;
Boolean *nothingChanged;
Boolean origNothingChanged;
public:
editSpecialInfoDialog():baseMovableDialog() { lastItemHit = kFirstSITE; lastETItemHit = kFirstSITE; };
editSpecialInfoDialog( DialogRef thisD, WindowRef parentW ): baseMovableDialog( thisD, parentW )
{ lastItemHit = kFirstSITE; lastETItemHit = kFirstSITE; };
void SetupCharPtr( CharacterFilePtr theC )
{ dialogData = (long)theC; temporaryCharacter = *((CharacterFilePtr)dialogData); };
void SetupSaved( Boolean * theB ) { nothingChanged = theB; origNothingChanged = *theB; };
void DoItemHit( EventRecord *, int );
void DoSelectAll() { NemesisSelectItemText( thisDialog, lastETItemHit ); };
void DoUpdateMenus();
void SetupDialog();
Boolean CheckValues();
void TransferValues();
};
class editGoodConditionsDialog:public baseMovableDialog
{
private:
int lastItemHit;
int lastETItemHit;
CharacterFile temporaryCharacter;
Boolean *nothingChanged;
Boolean origNothingChanged;
public:
editGoodConditionsDialog():baseMovableDialog() { lastItemHit = kFirstGCTE; lastETItemHit = kFirstGCTE; };
editGoodConditionsDialog( DialogRef thisD, WindowRef parentW ): baseMovableDialog( thisD, parentW )
{ lastItemHit = kFirstGCTE; lastETItemHit = kFirstGCTE; };
void SetupCharPtr( CharacterFilePtr theC )
{ dialogData = (long)theC; temporaryCharacter = *((CharacterFilePtr)dialogData); };
void SetupSaved( Boolean * theB ) { nothingChanged = theB; origNothingChanged = *theB; };
void DoItemHit( EventRecord *, int );
void DoSelectAll() { NemesisSelectItemText( thisDialog, lastETItemHit ); };
void DoUpdateMenus();
void SetupDialog();
Boolean CheckValues();
void TransferValues();
void MagicButton();
void AntiMagicButton();
};
class editBadConditionsDialog:public baseMovableDialog
{
private:
int lastItemHit;
int lastETItemHit;
CharacterFile temporaryCharacter;
Boolean *nothingChanged;
Boolean origNothingChanged;
public:
editBadConditionsDialog():baseMovableDialog() { lastItemHit = kFirstBCTE; lastETItemHit = kFirstBCTE; };
editBadConditionsDialog( DialogRef thisD, WindowRef parentW ): baseMovableDialog( thisD, parentW )
{ lastItemHit = kFirstBCTE; lastETItemHit = kFirstBCTE; };
void SetupCharPtr( CharacterFilePtr theC )
{ dialogData = (long)theC; temporaryCharacter = *((CharacterFilePtr)dialogData); };
void SetupSaved( Boolean * theB ) { nothingChanged = theB; origNothingChanged = *theB; };
void DoItemHit( EventRecord *, int );
void DoSelectAll() { NemesisSelectItemText( thisDialog, lastETItemHit ); };
void DoUpdateMenus();
void SetupDialog();
Boolean CheckValues();
void TransferValues();
void MagicButton();
void AntiMagicButton();
};
class editSpellsDialog:public baseMovableDialog
{
private:
CharacterFile temporaryCharacter;
Boolean *nothingChanged;
Boolean origNothingChanged;
int lastBoxClicked;
public:
void SetLastBoxClicked( int );
void DrawDescription();
editSpellsDialog():baseMovableDialog()
{
lastBoxClicked = kFirstSCheck;
};
editSpellsDialog( DialogRef thisD, WindowRef parentW ): baseMovableDialog( thisD, parentW )
{
lastBoxClicked = kFirstSCheck;
};
void SetupCharPtr( CharacterFilePtr theC )
{ dialogData = (long)theC; temporaryCharacter = *((CharacterFilePtr)dialogData); };
void SetupSaved( Boolean * theB ) { nothingChanged = theB; origNothingChanged = *theB; };
void DoItemHit( EventRecord *, int );
void SetupSpellNames();
void DoUpdateMenus();
void SetupDialog();
void TransferValues();
void MagicButton();
void AntiMagicButton();
void DoActivate( EventRecord * );
};
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••
// Prototypes
template<class T>
void Squash( T &, long, long );
#endif